Computer systems may have both a general-purpose memory and one or more auxiliary or special-purpose memories. One example of such an auxiliary memory is an auxiliary memory used by a graphics subsystem, known as graphics memory or video memory. When a graphics subsystem has dedicated to it a graphics memory that is only used for graphics display purposes, that graphics memory may provide increased efficiency, especially if the memory is optimized for high-performance in use with the computer's display.
Different processes or threads may want to write information into an auxiliary memory. Access to the auxiliary memory is handled by some managing entity in the computer, often within the operating system. Concurrent access to the auxiliary memory by multiple processes or threads may be unproblematic. However, in certain situations, it is desirable to allow only one process or thread to write to the auxiliary memory at once.
One example of such a situation is when a process will reset or erase the auxiliary memory. In a graphics application, this may occur when the display needs to be reinitialized. For example, in a mode switch, such as a mode switch for a change in display resolution or color fidelity, a reset or erasure of graphics memory is necessary.
If a first process is accessing the graphics memory for reading or writing data, and a mode-switching second process will reinitialize the graphics memory, at least two possibilities exist in the prior art for handling access by the threads to the graphics memory.
A first possibility is to allow these processes to run concurrently. This technique presents two problems. First, if the first process reads data from locations that have been erased due to the mode-switching second process, errors may occur in the first process. Second, if the first process writes data to the graphics memory, this data may be lost when the mode-switching second process erases the graphics memory. As a result, such data may need to be regenerated by the first process for display. The user may experience a delay or error due to allowing both processes to run concurrently.
A second possibility for handling access by multiple threads to the graphics memory is to have the mode-switching process wait for the first process to conclude or respond to an interrupt request before it acts on the graphics memory. This, however, may cause a delay that may be noticeable to the user.
In view of the foregoing, there is a need for a technique that overcomes the drawbacks of the prior art.